package com.omar.labs.tamtamy.JSON;

import com.omar.labs.tamtamy.ContentFile;
import com.omar.labs.tamtamy.TagList;

public class JSONContentFile extends ContentFile {

	public JSONContentFile(String json) {
		//this.id = Long.parseLong(JSONUtility.getNodeValue(json, "\"id\""));
		String contentFileName = JSONUtility.getNodeValue(json, "\"contentFileName\"");
		this.title = JSONUtility.getNodeValue(json, "\"title\"");
		this.url = JSONUtility.getNodeValue(json, "\"url\"");
		this.description = JSONUtility.getNodeValue(json, "\"description\"");
		this.permission = Long.parseLong(JSONUtility.getNodeValue(json, "\"permission\""));
		this.discussionPermission = Long.parseLong(JSONUtility.getNodeValue(json, "\"discussionPermission\""));
		this.size = Long.parseLong(JSONUtility.getNodeValue(json, "\"size\""));
		//this.creationDate = JSONUtility.getNodeValueWithAttribute(json, "\"creationDate"\", "\"class=\"\"sql-timestamp\"\"\"");
		this.thumbnailPresent = Boolean.parseBoolean(JSONUtility.getNodeValue(json, "\"thumbnailPresent\""));
		this.userID = JSONUtility.getNodeValue(json, "\"userID\"");
		this.favouriteCounter = Long.parseLong(JSONUtility.getNodeValue(json, "\"favouriteCounter\""));
		this.highlight = Boolean.parseBoolean(JSONUtility.getNodeValue(json, "\"highlight\""));
		this.numberOfComments = Long.parseLong(JSONUtility.getNodeValue(json, "\"numberOfComments\""));;
		this.rateEnabled = Boolean.parseBoolean(JSONUtility.getNodeValue(json, "\"rateEnabled\""));
		this.contentFileName = JSONUtility.getNodeValue(json, "\"contentFileName\"");
		//this.updateDate = JSONUtility.getNodeValueWithAttribute(json, "\"updateDate"\", "\"class=\"\"sql-timestamp\"\"\"");
		this.tagList = new TagList(JSONUtility.getNodesValue(JSONUtility.getNodeValueWithList(json, "\"tagList\"")));
		
			
	}

}
